﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ShoppingCartWEB.Admin
{
    public partial class ProductManager : System.Web.UI.Page
    {
        private int nSkip = 0;
        private int nTake = 0;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void loadData()
        {

        }

        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                gvProducts.EditIndex = e.NewEditIndex;
                loadData();
                ((TextBox)gvProducts.Rows[gvProducts.EditIndex].Cells[1].Controls[0]).Enabled = false;
              //  btnAddNew.Enabled = false;
            }
            catch (Exception ex)
            {
                Response.Write("Error: " + ex.Message);
            }
        }

        protected void gvProducts_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            gvProducts.EditIndex = -1;
            //if (btnAddNew.Enabled)
            loadData();
            //else
            //gvBooks.DeleteRow(e.RowIndex);
            //btnAddNew.Enabled = true;
        }

        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            Response.Redirect("AddNewProduct.aspx");
        }


    }

}